home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / time / c / utimes < prev   
Text File  |  1996-11-09  |  1KB  |  49 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/time/c/RCS/utimes,v $
  4.  * $Date: 1996/10/30 21:59:01 $
  5.  * $Revision: 1.3 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: utimes,v $
  10.  * Revision 1.3  1996/10/30 21:59:01  unixlib
  11.  * Massive changes made by Nick Burret and Peter Burwood.
  12.  *
  13.  * Revision 1.2  1996/09/16 21:23:52  unixlib
  14.  * CL_0002 Nick Burret
  15.  * Minor changes to file handling
  16.  * Change most error numbers, and use in assembler sources (SJC)
  17.  * Various minor bug fixes and compatability changes.
  18.  *
  19.  * Revision 1.1  1996/04/19 21:35:00  simon
  20.  * Initial revision
  21.  *
  22.  * Written by Nick Burrett, 17 Feb 1996.
  23.  ***************************************************************************/
  24.  
  25. static const char rcs_id[] = "$Id: utimes,v 1.3 1996/10/30 21:59:01 unixlib Rel $";
  26.  
  27. #include <sys/time.h>
  28. #include <errno.h>
  29. #include <stddef.h>
  30. #include <sys/unix.h>
  31. #include <sys/os.h>
  32. #include <utime.h>
  33.  
  34. /* The utimes function is like utime, but also lets you specify the
  35.    fractional part of the file times.
  36.  
  37.    Change the access time of 'file' to tvp[0] and
  38.    the modification time of 'file' to tvp[1].
  39.  
  40.    On RISC OS, we just alter the modification time.  */
  41.  
  42. int
  43. utimes (char *file, struct timeval tvp[2])
  44. {
  45.   /* Firstly, we must convert the micro-seconds to centi-seconds.  */
  46.   time_t temp = (tvp[1].tv_usec / 10000) + tvp[1].tv_sec * 100;
  47.   return utime (file, (struct utimbuf*)&temp);
  48. }
  49.